package com.hzjh.base.ext.frame

import android.os.Bundle
import androidx.viewbinding.ViewBinding
import com.alibaba.android.arouter.launcher.ARouter
import com.blankj.utilcode.util.BarUtils
import com.hzjh.base.frame.BaseViewModel
import com.hzjh.base.frame.activity.BaseTVMActivity
import com.hzjh.base.utils.other.ActivityStackManage

//根据项目自定义Base
abstract class JHBaseActivity<T : ViewBinding, VM : BaseViewModel> : BaseTVMActivity<T,VM>() {
    //状态栏
    //Activity Manager
    //loading
    //埋点等
    override fun onCreate(savedInstanceState: Bundle?) {
        //改主题
        BarUtils.setStatusBarLightMode(this, isStatusBarLightMode())
        BarUtils.transparentStatusBar(this)
        ARouter.getInstance().inject(this)
        super.onCreate(savedInstanceState)
        ActivityStackManage.addActivity(this)
    }

    override fun onDestroy() {
        super.onDestroy()
        ActivityStackManage.removeActivityStack(this)
    }

    // true: black icon / false: white icon
    protected open fun isStatusBarLightMode() = true

}